package com.doctcloud.hisinfo.outpbill.controller;

import com.doctcloud.hisinfo.histable.domain.outpbill.OutpRcptMasterDo;
import com.doctcloud.hisinfo.outpbill.request.RcptMasterParm;
import com.doctcloud.hisinfo.outpbill.service.IOutpRcptMasterService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.Date;
import java.util.List;

import static com.doctcloud.common.core.utils.DateUtils.endOfDay;
import static com.doctcloud.common.core.utils.DateUtils.startOfDay;

@RestController
@RequestMapping(value = "/outpbill/")
public class OutpRcptMasterController {
    @Autowired
    private IOutpRcptMasterService outpRcptMasterService;

    @GetMapping("/outprcptmaster/listByDate")
    public List<OutpRcptMasterDo> listByDate(@RequestParam("startDate") Date startDate,
                                             @RequestParam("endDate") Date endDate){
        RcptMasterParm rcptMasterParm = new RcptMasterParm();
        startDate = startOfDay(startDate);
        endDate = endOfDay(endDate);
        rcptMasterParm.setStartDate(startDate);
        rcptMasterParm.setEndDate(endDate);
        return outpRcptMasterService.listByRank(rcptMasterParm);
    }

}
